﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using MySql.Data.MySqlClient;
using ZingFrameworkCore.Common.Injection;

namespace ZingFrameworkCore.Data
{
    public class MySqlHelper
    {
        public static IConfiguration configuration =>
                  ServiceProviderAccessor.ServiceProvider.GetService<IConfiguration>();

        public static System.Data.IDbConnection GetConnection()
        {
            var connection = new MySqlConnection(configuration["ConnectionStrings:MySqlConnectionString"]);
            connection.Open();
            return connection;
        }
    }
}
